home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 July: Mac OS SDK / Dev.CD Jul 00 SDK2.toast / Development Kits / Cross Platform / QuickTime 4.1.2 Windows SDK / CIncludes / Dialogs.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-04-12  |  27.3 KB  |  846 lines  |  [TEXT/R*ch]

  1. /*
  2.      File:        Dialogs.h
  3.  
  4.      Contains:    Dialog Manager interfaces.
  5.  
  6.      Version:    Technology:    Mac OS 9
  7.                  Release:    QuickTime 4.1
  8.  
  9.      Copyright:    (c) 1985-1999 by Apple Computer, Inc., all rights reserved
  10.  
  11.      Bugs?:        For bug reports, consult the following page on
  12.                  the World Wide Web:
  13.  
  14.                      http://developer.apple.com/bugreporter/
  15.  
  16. */
  17. #ifndef __DIALOGS__
  18. #define __DIALOGS__
  19.  
  20. #ifndef __MACTYPES__
  21.     #include <MacTypes.h>
  22. #endif
  23.  
  24. #ifndef __MIXEDMODE__
  25.     #include <MixedMode.h>
  26. #endif
  27.  
  28. #ifndef __EVENTS__
  29.     #include <Events.h>
  30. #endif
  31.  
  32. #ifndef __MACWINDOWS__
  33.     #include <MacWindows.h>
  34. #endif
  35.  
  36. #ifndef __TEXTEDIT__
  37.     #include <TextEdit.h>
  38. #endif
  39.  
  40. #ifndef __CONTROLS__
  41.     #include <Controls.h>
  42. #endif
  43.  
  44. #ifndef __MACERRORS__
  45.     #include <MacErrors.h>
  46. #endif
  47.  
  48.  
  49.  
  50.  
  51. #if PRAGMA_ONCE
  52. #pragma once
  53. #endif
  54.  
  55. #ifdef __cplusplus
  56. extern "C" {
  57. #endif
  58.  
  59. #if PRAGMA_IMPORT
  60. #pragma import on
  61. #endif
  62.  
  63. #if PRAGMA_STRUCT_ALIGN
  64.     #pragma options align=mac68k
  65. #elif PRAGMA_STRUCT_PACKPUSH
  66.     #pragma pack(push, 2)
  67. #elif PRAGMA_STRUCT_PACK
  68.     #pragma pack(2)
  69. #endif
  70.  
  71. enum {
  72.                                                                 /* new, more standard names for dialog item types*/
  73.     kControlDialogItem            = 4,
  74.     kButtonDialogItem            = kControlDialogItem | 0,
  75.     kCheckBoxDialogItem            = kControlDialogItem | 1,
  76.     kRadioButtonDialogItem        = kControlDialogItem | 2,
  77.     kResourceControlDialogItem    = kControlDialogItem | 3,
  78.     kStaticTextDialogItem        = 8,
  79.     kEditTextDialogItem            = 16,
  80.     kIconDialogItem                = 32,
  81.     kPictureDialogItem            = 64,
  82.     kUserDialogItem                = 0,
  83.     kItemDisableBit                = 128
  84. };
  85.  
  86. enum {
  87.                                                                 /* old names for dialog item types*/
  88.     ctrlItem                    = 4,
  89.     btnCtrl                        = 0,
  90.     chkCtrl                        = 1,
  91.     radCtrl                        = 2,
  92.     resCtrl                        = 3,
  93.     statText                    = 8,
  94.     editText                    = 16,
  95.     iconItem                    = 32,
  96.     picItem                        = 64,
  97.     userItem                    = 0,
  98.     itemDisable                    = 128
  99. };
  100.  
  101. enum {
  102.                                                                 /* standard dialog item numbers*/
  103.     kStdOkItemIndex                = 1,
  104.     kStdCancelItemIndex            = 2,                            /* old names*/
  105.     ok                            = kStdOkItemIndex,
  106.     cancel                        = kStdCancelItemIndex
  107. };
  108.  
  109. enum {
  110.                                                                 /* standard icon resource id's     */
  111.     kStopIcon                    = 0,
  112.     kNoteIcon                    = 1,
  113.     kCautionIcon                = 2,                            /* old names*/
  114.     stopIcon                    = kStopIcon,
  115.     noteIcon                    = kNoteIcon,
  116.     cautionIcon                    = kCautionIcon
  117. };
  118.  
  119.  
  120.  
  121.  
  122. #if OLDROUTINENAMES
  123. /*
  124.    These constants lived briefly on ETO 16.  They suggest
  125.    that there is only one index you can use for the OK 
  126.    item, which is not true.  You can put the ok item 
  127.    anywhere you want in the DITL.
  128. */
  129. enum {
  130.     kOkItemIndex                = 1,
  131.     kCancelItemIndex            = 2
  132. };
  133.  
  134. #endif  /* OLDROUTINENAMES */
  135.  
  136. /*    Dialog Item List Manipulation Constants    */
  137. typedef SInt16                             DITLMethod;
  138. enum {
  139.     overlayDITL                    = 0,
  140.     appendDITLRight                = 1,
  141.     appendDITLBottom            = 2
  142. };
  143.  
  144. typedef SInt16                             StageList;
  145. /* DialogRef is obsolete. Use DialogPtr instead.*/
  146. typedef DialogPtr                         DialogRef;
  147. #if !OPAQUE_TOOLBOX_STRUCTS
  148.  
  149. struct DialogRecord {
  150.     WindowRecord                     window;
  151.     Handle                             items;
  152.     TEHandle                         textH;
  153.     SInt16                             editField;
  154.     SInt16                             editOpen;
  155.     SInt16                             aDefItem;
  156. };
  157. typedef struct DialogRecord                DialogRecord;
  158.  
  159. typedef DialogRecord *                    DialogPeek;
  160. #endif  /* !OPAQUE_TOOLBOX_STRUCTS */
  161.  
  162.  
  163. struct DialogTemplate {
  164.     Rect                             boundsRect;
  165.     SInt16                             procID;
  166.     Boolean                         visible;
  167.     Boolean                         filler1;
  168.     Boolean                         goAwayFlag;
  169.     Boolean                         filler2;
  170.     SInt32                             refCon;
  171.     SInt16                             itemsID;
  172.     Str255                             title;
  173. };
  174. typedef struct DialogTemplate            DialogTemplate;
  175.  
  176. typedef DialogTemplate *                DialogTPtr;
  177. typedef DialogTPtr *                    DialogTHndl;
  178.  
  179. struct AlertTemplate {
  180.     Rect                             boundsRect;
  181.     SInt16                             itemsID;
  182.     StageList                         stages;
  183. };
  184. typedef struct AlertTemplate            AlertTemplate;
  185.  
  186. typedef AlertTemplate *                    AlertTPtr;
  187. typedef AlertTPtr *                        AlertTHndl;
  188. /* new type abstractions for the dialog manager */
  189. typedef SInt16                             DialogItemIndexZeroBased;
  190. typedef SInt16                             DialogItemIndex;
  191. typedef SInt16                             DialogItemType;
  192. /* dialog manager callbacks */
  193. typedef CALLBACK_API( void , SoundProcPtr )(SInt16 soundNumber);
  194. typedef CALLBACK_API( Boolean , ModalFilterProcPtr )(DialogPtr theDialog, EventRecord *theEvent, DialogItemIndex *itemHit);
  195. typedef CALLBACK_API( void , UserItemProcPtr )(DialogPtr theDialog, DialogItemIndex itemNo);
  196. typedef STACK_UPP_TYPE(SoundProcPtr)                             SoundUPP;
  197. typedef STACK_UPP_TYPE(ModalFilterProcPtr)                         ModalFilterUPP;
  198. typedef STACK_UPP_TYPE(UserItemProcPtr)                         UserItemUPP;
  199. #if OPAQUE_UPP_TYPES
  200.     EXTERN_API(SoundUPP)
  201.     NewSoundUPP                       (SoundProcPtr            userRoutine);
  202.  
  203.     EXTERN_API(ModalFilterUPP)
  204.     NewModalFilterUPP               (ModalFilterProcPtr        userRoutine);
  205.  
  206.     EXTERN_API(UserItemUPP)
  207.     NewUserItemUPP                   (UserItemProcPtr            userRoutine);
  208.  
  209.     EXTERN_API(void)
  210.     DisposeSoundUPP                   (SoundUPP                userUPP);
  211.  
  212.     EXTERN_API(void)
  213.     DisposeModalFilterUPP           (ModalFilterUPP            userUPP);
  214.  
  215.     EXTERN_API(void)
  216.     DisposeUserItemUPP               (UserItemUPP                userUPP);
  217.  
  218.     EXTERN_API(void)
  219.     InvokeSoundUPP                   (SInt16                    soundNumber,
  220.                                     SoundUPP                userUPP);
  221.  
  222.     EXTERN_API(Boolean)
  223.     InvokeModalFilterUPP           (DialogPtr                theDialog,
  224.                                     EventRecord *            theEvent,
  225.                                     DialogItemIndex *        itemHit,
  226.                                     ModalFilterUPP            userUPP);
  227.  
  228.     EXTERN_API(void)
  229.     InvokeUserItemUPP               (DialogPtr                theDialog,
  230.                                     DialogItemIndex            itemNo,
  231.                                     UserItemUPP                userUPP);
  232.  
  233. #else
  234.     enum { uppSoundProcInfo = 0x00000080 };                         /* pascal no_return_value Func(2_bytes) */
  235.     enum { uppModalFilterProcInfo = 0x00000FD0 };                     /* pascal 1_byte Func(4_bytes, 4_bytes, 4_bytes) */
  236.     enum { uppUserItemProcInfo = 0x000002C0 };                         /* pascal no_return_value Func(4_bytes, 2_bytes) */
  237.     #define NewSoundUPP(userRoutine)                                 (SoundUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppSoundProcInfo, GetCurrentArchitecture())
  238.     #define NewModalFilterUPP(userRoutine)                             (ModalFilterUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppModalFilterProcInfo, GetCurrentArchitecture())
  239.     #define NewUserItemUPP(userRoutine)                             (UserItemUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppUserItemProcInfo, GetCurrentArchitecture())
  240.     #define DisposeSoundUPP(userUPP)                                 DisposeRoutineDescriptor(userUPP)
  241.     #define DisposeModalFilterUPP(userUPP)                             DisposeRoutineDescriptor(userUPP)
  242.     #define DisposeUserItemUPP(userUPP)                             DisposeRoutineDescriptor(userUPP)
  243.     #define InvokeSoundUPP(soundNumber, userUPP)                     CALL_ONE_PARAMETER_UPP((userUPP), uppSoundProcInfo, (soundNumber))
  244.     #define InvokeModalFilterUPP(theDialog, theEvent, itemHit, userUPP)  (Boolean)CALL_THREE_PARAMETER_UPP((userUPP), uppModalFilterProcInfo, (theDialog), (theEvent), (itemHit))
  245.     #define InvokeUserItemUPP(theDialog, itemNo, userUPP)             CALL_TWO_PARAMETER_UPP((userUPP), uppUserItemProcInfo, (theDialog), (itemNo))
  246. #endif
  247. /* support for pre-Carbon UPP routines: NewXXXProc and CallXXXProc */
  248. #define NewSoundProc(userRoutine)                                 NewSoundUPP(userRoutine)
  249. #define NewModalFilterProc(userRoutine)                         NewModalFilterUPP(userRoutine)
  250. #define NewUserItemProc(userRoutine)                             NewUserItemUPP(userRoutine)
  251. #define CallSoundProc(userRoutine, soundNumber)                    InvokeSoundUPP(soundNumber, userRoutine)
  252. #define CallModalFilterProc(userRoutine, theDialog, theEvent, itemHit) InvokeModalFilterUPP(theDialog, theEvent, itemHit, userRoutine)
  253. #define CallUserItemProc(userRoutine, theDialog, itemNo)        InvokeUserItemUPP(theDialog, itemNo, userRoutine)
  254.  
  255. #if !TARGET_OS_MAC
  256. /* QuickTime 3.0 */
  257. typedef CALLBACK_API_C( void , QTModelessCallbackProcPtr )(EventRecord *theEvent, DialogPtr theDialog, DialogItemIndex itemHit);
  258. EXTERN_API( void )
  259. SetModelessDialogCallbackProc    (DialogPtr                 theDialog,
  260.                                  QTModelessCallbackProcPtr  callbackProc);
  261.  
  262. typedef QTModelessCallbackProcPtr         QTModelessCallbackUPP;
  263. EXTERN_API( OSErr )
  264. GetDialogControlNotificationProc (void *                theProc);
  265.  
  266. EXTERN_API( void )
  267. SetDialogMovableModal            (DialogPtr                 theDialog);
  268.  
  269. EXTERN_API( void *)
  270. GetDialogParent                    (DialogPtr                 theDialog);
  271.  
  272. #endif  /* !TARGET_OS_MAC */
  273.  
  274. /*
  275.   ---------------------------------------------------------------------------------------------------------
  276.       o Following types are valid with Appearance 1.0 and later
  277.   ---------------------------------------------------------------------------------------------------------
  278. */
  279. enum {
  280.                                                                 /* Alert types to pass into StandardAlert */
  281.     kAlertStopAlert                = 0,
  282.     kAlertNoteAlert                = 1,
  283.     kAlertCautionAlert            = 2,
  284.     kAlertPlainAlert            = 3
  285. };
  286.  
  287. typedef SInt16                             AlertType;
  288. enum {
  289.     kAlertDefaultOKText            = -1,                            /* "OK"*/
  290.     kAlertDefaultCancelText        = -1,                            /* "Cancel"*/
  291.     kAlertDefaultOtherText        = -1                            /* "Don't Save"*/
  292. };
  293.  
  294. /* StandardAlert alert button numbers */
  295. enum {
  296.     kAlertStdAlertOKButton        = 1,
  297.     kAlertStdAlertCancelButton    = 2,
  298.     kAlertStdAlertOtherButton    = 3,
  299.     kAlertStdAlertHelpButton    = 4
  300. };
  301.  
  302. enum {
  303.                                                                 /* Dialog Flags for use in NewFeaturesDialog or dlgx resource */
  304.     kDialogFlagsUseThemeBackground = (1 << 0),
  305.     kDialogFlagsUseControlHierarchy = (1 << 1),
  306.     kDialogFlagsHandleMovableModal = (1 << 2),
  307.     kDialogFlagsUseThemeControls = (1 << 3)
  308. };
  309.  
  310. enum {
  311.                                                                 /* Alert Flags for use in alrx resource */
  312.     kAlertFlagsUseThemeBackground = (1 << 0),
  313.     kAlertFlagsUseControlHierarchy = (1 << 1),
  314.     kAlertFlagsAlertIsMovable    = (1 << 2),
  315.     kAlertFlagsUseThemeControls    = (1 << 3)
  316. };
  317.  
  318. /* For dftb resource */
  319. enum {
  320.     kDialogFontNoFontStyle        = 0,
  321.     kDialogFontUseFontMask        = 0x0001,
  322.     kDialogFontUseFaceMask        = 0x0002,
  323.     kDialogFontUseSizeMask        = 0x0004,
  324.     kDialogFontUseForeColorMask    = 0x0008,
  325.     kDialogFontUseBackColorMask    = 0x0010,
  326.     kDialogFontUseModeMask        = 0x0020,
  327.     kDialogFontUseJustMask        = 0x0040,
  328.     kDialogFontUseAllMask        = 0x00FF,
  329.     kDialogFontAddFontSizeMask    = 0x0100,
  330.     kDialogFontUseFontNameMask    = 0x0200,
  331.     kDialogFontAddToMetaFontMask = 0x0400
  332. };
  333.  
  334.  
  335. struct AlertStdAlertParamRec {
  336.     Boolean                         movable;                    /* Make alert movable modal */
  337.     Boolean                         helpButton;                    /* Is there a help button? */
  338.     ModalFilterUPP                     filterProc;                    /* Event filter */
  339.     ConstStringPtr                     defaultText;                /* Text for button in OK position */
  340.     ConstStringPtr                     cancelText;                    /* Text for button in cancel position */
  341.     ConstStringPtr                     otherText;                    /* Text for button in left position */
  342.     SInt16                             defaultButton;                /* Which button behaves as the default */
  343.     SInt16                             cancelButton;                /* Which one behaves as cancel (can be 0) */
  344.     UInt16                             position;                    /* Position (kWindowDefaultPosition in this case */
  345.                                                                 /* equals kWindowAlertPositionParentWindowScreen) */
  346. };
  347. typedef struct AlertStdAlertParamRec    AlertStdAlertParamRec;
  348.  
  349. typedef AlertStdAlertParamRec *            AlertStdAlertParamPtr;
  350. /* --- end Appearance 1.0 or later stuff*/
  351.  
  352.  
  353. /*
  354.     NOTE: Code running under MultiFinder or System 7.0 or newer
  355.     should always pass NULL to InitDialogs.
  356. */
  357. EXTERN_API( void )
  358. InitDialogs                        (void *                    ignored)                            ONEWORDINLINE(0xA97B);
  359.  
  360. EXTERN_API( void )
  361. ErrorSound                        (SoundUPP                 soundProc)                            ONEWORDINLINE(0xA98C);
  362.  
  363. EXTERN_API( DialogPtr )
  364. NewDialog                        (void *                    dStorage,
  365.                                  const Rect *            boundsRect,
  366.                                  ConstStr255Param         title,
  367.                                  Boolean                 visible,
  368.                                  SInt16                 procID,
  369.                                  WindowPtr                 behind,
  370.                                  Boolean                 goAwayFlag,
  371.                                  SInt32                 refCon,
  372.                                  Handle                 items)                                ONEWORDINLINE(0xA97D);
  373.  
  374. EXTERN_API( DialogPtr )
  375. GetNewDialog                    (SInt16                 dialogID,
  376.                                  void *                    dStorage,
  377.                                  WindowPtr                 behind)                                ONEWORDINLINE(0xA97C);
  378.  
  379. EXTERN_API( DialogPtr )
  380. NewColorDialog                    (void *                    dStorage,
  381.                                  const Rect *            boundsRect,
  382.                                  ConstStr255Param         title,
  383.                                  Boolean                 visible,
  384.                                  SInt16                 procID,
  385.                                  WindowPtr                 behind,
  386.                                  Boolean                 goAwayFlag,
  387.                                  SInt32                 refCon,
  388.                                  Handle                 items)                                ONEWORDINLINE(0xAA4B);
  389.  
  390. EXTERN_API( void )
  391. CloseDialog                        (DialogPtr                 theDialog)                            ONEWORDINLINE(0xA982);
  392.  
  393. EXTERN_API( void )
  394. DisposeDialog                    (DialogPtr                 theDialog)                            ONEWORDINLINE(0xA983);
  395.  
  396. EXTERN_API( void )
  397. ModalDialog                        (ModalFilterUPP         modalFilter,
  398.                                  DialogItemIndex *        itemHit)                            ONEWORDINLINE(0xA991);
  399.  
  400. EXTERN_API( Boolean )
  401. IsDialogEvent                    (const EventRecord *    theEvent)                            ONEWORDINLINE(0xA97F);
  402.  
  403. EXTERN_API( Boolean )
  404. DialogSelect                    (const EventRecord *    theEvent,
  405.                                  DialogPtr *            theDialog,
  406.                                  DialogItemIndex *        itemHit)                            ONEWORDINLINE(0xA980);
  407.  
  408. EXTERN_API( void )
  409. DrawDialog                        (DialogPtr                 theDialog)                            ONEWORDINLINE(0xA981);
  410.  
  411. EXTERN_API( void )
  412. UpdateDialog                    (DialogPtr                 theDialog,
  413.                                  RgnHandle                 updateRgn)                            ONEWORDINLINE(0xA978);
  414.  
  415. EXTERN_API( void )
  416. HideDialogItem                    (DialogPtr                 theDialog,
  417.                                  DialogItemIndex         itemNo)                                ONEWORDINLINE(0xA827);
  418.  
  419. EXTERN_API( void )
  420. ShowDialogItem                    (DialogPtr                 theDialog,
  421.                                  DialogItemIndex         itemNo)                                ONEWORDINLINE(0xA828);
  422.  
  423. EXTERN_API( DialogItemIndexZeroBased )
  424. FindDialogItem                    (DialogPtr                 theDialog,
  425.                                  Point                     thePt)                                ONEWORDINLINE(0xA984);
  426.  
  427. EXTERN_API( void )
  428. DialogCut                        (DialogPtr                 theDialog);
  429.  
  430. EXTERN_API( void )
  431. DialogPaste                        (DialogPtr                 theDialog);
  432.  
  433. EXTERN_API( void )
  434. DialogCopy                        (DialogPtr                 theDialog);
  435.  
  436. EXTERN_API( void )
  437. DialogDelete                    (DialogPtr                 theDialog);
  438.  
  439. EXTERN_API( DialogItemIndex )
  440. Alert                            (SInt16                 alertID,
  441.                                  ModalFilterUPP         modalFilter)                        ONEWORDINLINE(0xA985);
  442.  
  443. EXTERN_API( DialogItemIndex )
  444. StopAlert                        (SInt16                 alertID,
  445.                                  ModalFilterUPP         modalFilter)                        ONEWORDINLINE(0xA986);
  446.  
  447. EXTERN_API( DialogItemIndex )
  448. NoteAlert                        (SInt16                 alertID,
  449.                                  ModalFilterUPP         modalFilter)                        ONEWORDINLINE(0xA987);
  450.  
  451. EXTERN_API( DialogItemIndex )
  452. CautionAlert                    (SInt16                 alertID,
  453.                                  ModalFilterUPP         modalFilter)                        ONEWORDINLINE(0xA988);
  454.  
  455. EXTERN_API( void )
  456. GetDialogItem                    (DialogPtr                 theDialog,
  457.                                  DialogItemIndex         itemNo,
  458.                                  DialogItemType *        itemType,
  459.                                  Handle *                item,
  460.                                  Rect *                    box)                                ONEWORDINLINE(0xA98D);
  461.  
  462. EXTERN_API( void )
  463. SetDialogItem                    (DialogPtr                 theDialog,
  464.                                  DialogItemIndex         itemNo,
  465.                                  DialogItemType         itemType,
  466.                                  Handle                 item,
  467.                                  const Rect *            box)                                ONEWORDINLINE(0xA98E);
  468.  
  469. EXTERN_API( void )
  470. ParamText                        (ConstStr255Param         param0,
  471.                                  ConstStr255Param         param1,
  472.                                  ConstStr255Param         param2,
  473.                                  ConstStr255Param         param3)                                ONEWORDINLINE(0xA98B);
  474.  
  475. EXTERN_API( void )
  476. SelectDialogItemText            (DialogPtr                 theDialog,
  477.                                  DialogItemIndex         itemNo,
  478.                                  SInt16                 strtSel,
  479.                                  SInt16                 endSel)                                ONEWORDINLINE(0xA97E);
  480.  
  481. EXTERN_API( void )
  482. GetDialogItemText                (Handle                 item,
  483.                                  Str255                 text)                                ONEWORDINLINE(0xA990);
  484.  
  485. EXTERN_API( void )
  486. SetDialogItemText                (Handle                 item,
  487.                                  ConstStr255Param         text)                                ONEWORDINLINE(0xA98F);
  488.  
  489. EXTERN_API( SInt16 )
  490. GetAlertStage                    (void)                                                        TWOWORDINLINE(0x3EB8, 0x0A9A);
  491.  
  492. EXTERN_API( void )
  493. SetDialogFont                    (SInt16                 fontNum)                            TWOWORDINLINE(0x31DF, 0x0AFA);
  494.  
  495. EXTERN_API( void )
  496. ResetAlertStage                    (void)                                                        TWOWORDINLINE(0x4278, 0x0A9A);
  497.  
  498. /* APIs in Carbon*/
  499. EXTERN_API( void )
  500. GetParamText                    (StringPtr                 param0,
  501.                                  StringPtr                 param1,
  502.                                  StringPtr                 param2,
  503.                                  StringPtr                 param3);
  504.  
  505.  
  506. EXTERN_API_C( DialogPtr )
  507. newdialog                        (void *                    dStorage,
  508.                                  const Rect *            boundsRect,
  509.                                  const char *            title,
  510.                                  Boolean                 visible,
  511.                                  SInt16                 procID,
  512.                                  WindowPtr                 behind,
  513.                                  Boolean                 goAwayFlag,
  514.                                  SInt32                 refCon,
  515.                                  Handle                 items);
  516.  
  517. EXTERN_API_C( DialogPtr )
  518. newcolordialog                    (void *                    dStorage,
  519.                                  const Rect *            boundsRect,
  520.                                  const char *            title,
  521.                                  Boolean                 visible,
  522.                                  SInt16                 procID,
  523.                                  WindowPtr                 behind,
  524.                                  Boolean                 goAwayFlag,
  525.                                  SInt32                 refCon,
  526.                                  Handle                 items);
  527.  
  528. EXTERN_API_C( void )
  529. paramtext                        (const char *            param0,
  530.                                  const char *            param1,
  531.                                  const char *            param2,
  532.                                  const char *            param3);
  533.  
  534. EXTERN_API_C( void )
  535. getdialogitemtext                (Handle                 item,
  536.                                  char *                    text);
  537.  
  538. EXTERN_API_C( void )
  539. setdialogitemtext                (Handle                 item,
  540.                                  const char *            text);
  541.  
  542. EXTERN_API_C( DialogItemIndexZeroBased )
  543. finddialogitem                    (DialogPtr                 theDialog,
  544.                                  Point *                thePt);
  545.  
  546. EXTERN_API( void )
  547. AppendDITL                        (DialogPtr                 theDialog,
  548.                                  Handle                 theHandle,
  549.                                  DITLMethod             method);
  550.  
  551. EXTERN_API( DialogItemIndex )
  552. CountDITL                        (DialogPtr                 theDialog);
  553.  
  554. EXTERN_API( void )
  555. ShortenDITL                        (DialogPtr                 theDialog,
  556.                                  DialogItemIndex         numberItems);
  557.  
  558. EXTERN_API( OSStatus )
  559. InsertDialogItem                (DialogPtr                 theDialog,
  560.                                  DialogItemIndex         afterItem,
  561.                                  DialogItemType         itemType,
  562.                                  Handle                 itemHandle,
  563.                                  const Rect *            box);
  564.  
  565. EXTERN_API( OSStatus )
  566. RemoveDialogItems                (DialogPtr                 theDialog,
  567.                                  DialogItemIndex         itemNo,
  568.                                  DialogItemIndex         amountToRemove,
  569.                                  Boolean                 disposeItemData);
  570.  
  571. EXTERN_API( Boolean )
  572. StdFilterProc                    (DialogPtr                 theDialog,
  573.                                  EventRecord *            event,
  574.                                  DialogItemIndex *        itemHit);
  575.  
  576. EXTERN_API( OSErr )
  577. GetStdFilterProc                (ModalFilterUPP *        theProc)                            THREEWORDINLINE(0x303C, 0x0203, 0xAA68);
  578.  
  579. EXTERN_API( OSErr )
  580. SetDialogDefaultItem            (DialogPtr                 theDialog,
  581.                                  DialogItemIndex         newItem)                            THREEWORDINLINE(0x303C, 0x0304, 0xAA68);
  582.  
  583. EXTERN_API( OSErr )
  584. SetDialogCancelItem                (DialogPtr                 theDialog,
  585.                                  DialogItemIndex         newItem)                            THREEWORDINLINE(0x303C, 0x0305, 0xAA68);
  586.  
  587. EXTERN_API( OSErr )
  588. SetDialogTracksCursor            (DialogPtr                 theDialog,
  589.                                  Boolean                 tracks)                                THREEWORDINLINE(0x303C, 0x0306, 0xAA68);
  590.  
  591.  
  592.  
  593. /*
  594.   ---------------------------------------------------------------------------------------------------------
  595.       o Appearance Dialog Routines (available only with Appearance 1.0 and later)
  596.   ---------------------------------------------------------------------------------------------------------
  597. */
  598.  
  599. EXTERN_API( DialogPtr )
  600. NewFeaturesDialog                (void *                    inStorage,
  601.                                  const Rect *            inBoundsRect,
  602.                                  ConstStr255Param         inTitle,
  603.                                  Boolean                 inIsVisible,
  604.                                  SInt16                 inProcID,
  605.                                  WindowPtr                 inBehind,
  606.                                  Boolean                 inGoAwayFlag,
  607.                                  SInt32                 inRefCon,
  608.                                  Handle                 inItemListHandle,
  609.                                  UInt32                 inFlags)                            THREEWORDINLINE(0x303C, 0x110C, 0xAA68);
  610.  
  611. EXTERN_API( OSErr )
  612. AutoSizeDialog                    (DialogPtr                 inDialog)                            THREEWORDINLINE(0x303C, 0x020D, 0xAA68);
  613.  
  614. /*
  615.     Regarding StandardAlert and constness:
  616.     Even though the inAlertParam parameter is marked const here, there was
  617.     a chance Dialog Manager would modify it on versions of Mac OS prior to 9.
  618. */
  619. EXTERN_API( OSErr )
  620. StandardAlert                    (AlertType                 inAlertType,
  621.                                  ConstStr255Param         inError,
  622.                                  ConstStr255Param         inExplanation,
  623.                                  const AlertStdAlertParamRec * inAlertParam,
  624.                                  SInt16 *                outItemHit)                            THREEWORDINLINE(0x303C, 0x090E, 0xAA68);
  625.  
  626. EXTERN_API( OSErr )
  627. GetDialogItemAsControl            (DialogPtr                 inDialog,
  628.                                  SInt16                 inItemNo,
  629.                                  ControlHandle *        outControl)                            THREEWORDINLINE(0x303C, 0x050F, 0xAA68);
  630.  
  631. EXTERN_API( OSErr )
  632. MoveDialogItem                    (DialogPtr                 inDialog,
  633.                                  SInt16                 inItemNo,
  634.                                  SInt16                 inHoriz,
  635.                                  SInt16                 inVert)                                THREEWORDINLINE(0x303C, 0x0510, 0xAA68);
  636.  
  637. EXTERN_API( OSErr )
  638. SizeDialogItem                    (DialogPtr                 inDialog,
  639.                                  SInt16                 inItemNo,
  640.                                  SInt16                 inWidth,
  641.                                  SInt16                 inHeight)                            THREEWORDINLINE(0x303C, 0x0511, 0xAA68);
  642.  
  643. EXTERN_API( OSErr )
  644. AppendDialogItemList            (DialogPtr                 dialog,
  645.                                  SInt16                 ditlID,
  646.                                  DITLMethod             method)                                THREEWORDINLINE(0x303C, 0x0412, 0xAA68);
  647.  
  648. /*
  649.   ---------------------------------------------------------------------------------------------------------
  650.       o Dialog Routines available only with Appearance 1.1 and later
  651.   ---------------------------------------------------------------------------------------------------------
  652. */
  653.  
  654. EXTERN_API( OSStatus )
  655. SetDialogTimeout                (DialogPtr                 inDialog,
  656.                                  SInt16                 inButtonToPress,
  657.                                  UInt32                 inSecondsToWait);
  658.  
  659. EXTERN_API( OSStatus )
  660. GetDialogTimeout                (DialogPtr                 inDialog,
  661.                                  SInt16 *                outButtonToPress,
  662.                                  UInt32 *                outSecondsToWait,
  663.                                  UInt32 *                outSecondsRemaining);
  664.  
  665. EXTERN_API( OSStatus )
  666. SetModalDialogEventMask            (DialogPtr                 inDialog,
  667.                                  EventMask                 inMask);
  668.  
  669. EXTERN_API( OSStatus )
  670. GetModalDialogEventMask            (DialogPtr                 inDialog,
  671.                                  EventMask *            outMask);
  672.  
  673. #if OLDROUTINENAMES
  674. #define DisposDialog(theDialog) DisposeDialog(theDialog)
  675. #define UpdtDialog(theDialog, updateRgn) UpdateDialog(theDialog, updateRgn)
  676. #define GetDItem(theDialog, itemNo, itemType, item, box) GetDialogItem(theDialog, itemNo, itemType, item, box)
  677. #define SetDItem(theDialog, itemNo, itemType, item, box) SetDialogItem(theDialog, itemNo, itemType, item, box)
  678. #define HideDItem(theDialog, itemNo) HideDialogItem(theDialog, itemNo)
  679. #define ShowDItem(theDialog, itemNo) ShowDialogItem(theDialog, itemNo)
  680. #define SelIText(theDialog, itemNo, strtSel, endSel) SelectDialogItemText(theDialog, itemNo, strtSel, endSel)
  681. #define GetIText(item, text) GetDialogItemText(item, text)
  682. #define SetIText(item, text) SetDialogItemText(item, text)
  683. #define FindDItem(theDialog, thePt) FindDialogItem(theDialog, thePt)
  684. #define NewCDialog(dStorage, boundsRect, title, visible, procID, behind, goAwayFlag, refCon, items) \
  685. NewColorDialog(dStorage, boundsRect, title, visible, procID, behind, goAwayFlag, refCon, items)
  686. #define GetAlrtStage() GetAlertStage()
  687. #define ResetAlrtStage() ResetAlertStage()
  688. #define DlgCut(theDialog) DialogCut(theDialog)
  689. #define DlgPaste(theDialog) DialogPaste(theDialog)
  690. #define DlgCopy(theDialog) DialogCopy(theDialog)
  691. #define DlgDelete(theDialog) DialogDelete(theDialog)
  692. #define SetDAFont(fontNum) SetDialogFont(fontNum)
  693. #if CGLUESUPPORTED
  694. #define newcdialog(dStorage, boundsRect, title, visible, procID, behind, goAwayFlag, refCon, items) \
  695. newcolordialog(dStorage, boundsRect, title, visible, procID, behind, goAwayFlag, refCon, items)
  696. #define getitext(item, text) getdialogitemtext(item, text)
  697. #define setitext(item, text) setdialogitemtext(item, text)
  698. #define findditem(theDialog, thePt) finddialogitem(theDialog, thePt)
  699. #endif
  700.  
  701. #endif  /* OLDROUTINENAMES */
  702.  
  703. /*
  704.     *****************************************************************************
  705.     *                                                                           *
  706.     * The conditional STRICT_DIALOGS has been removed from this interface file. *
  707.     * The accessor macros to a DialogRecord are no longer necessary.            *
  708.     *                                                                           *
  709.     * All *Ref Types have reverted to their original Handle and Ptr Types.      *
  710.     *                                                                           *
  711.     *****************************************************************************
  712.  
  713.     Details:
  714.     The original purpose of the STRICT_ conditionals and accessor macros was to
  715.     help ease the transition to Copland.  Shared data structures are difficult
  716.     to coordinate in a preemptive multitasking OS.  By hiding the fields in a
  717.     WindowRecord and other data structures, we would begin the migration to the
  718.     discipline wherein system data structures are completely hidden from
  719.     applications.
  720.     
  721.     After many design reviews, we finally concluded that with this sort of
  722.     migration, the system could never tell when an application was no longer
  723.     peeking at a WindowRecord, and thus the data structure might never become
  724.     system owned.  Additionally, there were many other limitations in the
  725.     classic toolbox that were begging to be addressed.  The final decision was
  726.     to leave the traditional toolbox as a compatibility mode.
  727.     
  728.     We also decided to use the Handle and Ptr based types in the function
  729.     declarations.  For example, NewWindow now returns a WindowPtr rather than a
  730.     WindowRef.  The Ref types are still defined in the header files, so all
  731.     existing code will still compile exactly as it did before.  There are
  732.     several reasons why we chose to do this:
  733.     
  734.     - The importance of backwards compatibility makes it unfeasible for us to
  735.     enforce real opaque references in the implementation anytime in the
  736.     foreseeable future.  Therefore, any opaque data types (e.g. WindowRef,
  737.     ControlRef, etc.) in the documentation and header files would always be a
  738.     fake veneer of opacity.
  739.     
  740.     - There exists a significant base of books and sample code that neophyte
  741.     Macintosh developers use to learn how to program the Macintosh.  These
  742.     books and sample code all use direct data access.  Introducing opaque data
  743.     types at this point would confuse neophyte programmers more than it would
  744.     help them.
  745.     
  746.     - Direct data structure access is used by nearly all Macintosh developers. 
  747.     Changing the interfaces to reflect a false opacity would not provide any
  748.     benefit to these developers.
  749.     
  750.     - Accessor functions are useful in and of themselves as convenience
  751.     functions, without being tied to opaque data types.  We will complete and
  752.     document the Windows and Dialogs accessor functions in an upcoming release
  753.     of the interfaces.
  754. */
  755. #if !OPAQUE_TOOLBOX_STRUCTS && !ACCESSOR_CALLS_ARE_FUNCTIONS
  756. #ifdef __cplusplus
  757. inline WindowPtr     GetDialogWindow(DialogPtr dialog)        { return (WindowPtr) dialog;                         }
  758. inline SInt16        GetDialogDefaultItem(DialogPtr dialog)  { return (*(SInt16 *) (((UInt8 *) dialog) + 168));    }
  759. inline SInt16        GetDialogCancelItem(DialogPtr dialog)     { return (*(SInt16 *) (((UInt8 *) dialog) + 166));    }
  760. inline SInt16        GetDialogKeyboardFocusItem(DialogPtr dialog)    { return (SInt16) ((*(SInt16 *) (((UInt8 *) dialog) + 164)) < 0 ? -1 : (*(SInt16 *) (((UInt8 *) dialog) + 164)) + 1); }
  761. inline void        SetGrafPortOfDialog(DialogPtr dialog) { MacSetPort ((GrafPtr) dialog); }
  762. #else
  763. #define GetDialogWindow(dialog)    ((WindowPtr) dialog)
  764. #define GetDialogDefaultItem(dialog) (*(SInt16 *) (((UInt8 *) dialog) + 168))
  765. #define GetDialogCancelItem(dialog) (*(SInt16 *) (((UInt8 *) dialog) + 166))
  766. #define GetDialogKeyboardFocusItem(dialog) ((SInt16)((*(SInt16 *) (((UInt8 *) dialog) + 164)) < 0 ? -1 : (*(SInt16 *) (((UInt8 *) dialog) + 164)) + 1))
  767. #define SetGrafPortOfDialog(dialog) do { MacSetPort ((GrafPtr) dialog); } while (false)
  768. #endif
  769. #endif  /* !OPAQUE_TOOLBOX_STRUCTS && !ACCESSOR_CALLS_ARE_FUNCTIONS */
  770.  
  771. #if ACCESSOR_CALLS_ARE_FUNCTIONS
  772. /* Getters */
  773. EXTERN_API( WindowPtr )
  774. GetDialogWindow                    (DialogPtr                 dialog);
  775.  
  776. EXTERN_API( TEHandle )
  777. GetDialogTextEditHandle            (DialogPtr                 dialog);
  778.  
  779. EXTERN_API( SInt16 )
  780. GetDialogDefaultItem            (DialogPtr                 dialog);
  781.  
  782. EXTERN_API( SInt16 )
  783. GetDialogCancelItem                (DialogPtr                 dialog);
  784.  
  785. EXTERN_API( SInt16 )
  786. GetDialogKeyboardFocusItem        (DialogPtr                 dialog);
  787.  
  788. /* Setters */
  789. /* Utilities */
  790. EXTERN_API( void )
  791. SetPortDialogPort                (DialogPtr                 dialog);
  792.  
  793. EXTERN_API( CGrafPtr )
  794. GetDialogPort                    (DialogPtr                 dialog);
  795.  
  796. /* To prevent upward dependencies, GetDialogFromWindow() is defined here instead of MacWindows.i */
  797. EXTERN_API( DialogPtr )
  798. GetDialogFromWindow                (WindowPtr                 window);
  799.  
  800. #endif  /* ACCESSOR_CALLS_ARE_FUNCTIONS */
  801.  
  802. EXTERN_API( void )
  803. CouldDialog                        (SInt16                 dialogID)                            ONEWORDINLINE(0xA979);
  804.  
  805. EXTERN_API( void )
  806. FreeDialog                        (SInt16                 dialogID)                            ONEWORDINLINE(0xA97A);
  807.  
  808. EXTERN_API( void )
  809. CouldAlert                        (SInt16                 alertID)                            ONEWORDINLINE(0xA989);
  810.  
  811. EXTERN_API( void )
  812. FreeAlert                        (SInt16                 alertID)                            ONEWORDINLINE(0xA98A);
  813.  
  814.  
  815.  
  816.  
  817.  
  818. #if !TARGET_OS_MAC
  819. #endif  /* !TARGET_OS_MAC */
  820.  
  821.  
  822.  
  823.  
  824.  
  825.  
  826. #if PRAGMA_STRUCT_ALIGN
  827.     #pragma options align=reset
  828. #elif PRAGMA_STRUCT_PACKPUSH
  829.     #pragma pack(pop)
  830. #elif PRAGMA_STRUCT_PACK
  831.     #pragma pack()
  832. #endif
  833.  
  834. #ifdef PRAGMA_IMPORT_OFF
  835. #pragma import off
  836. #elif PRAGMA_IMPORT
  837. #pragma import reset
  838. #endif
  839.  
  840. #ifdef __cplusplus
  841. }
  842. #endif
  843.  
  844. #endif /* __DIALOGS__ */
  845.  
  846.